package Init.Entity;
import lombok.*;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Data
@Entity
public class Student {
        public Student()
        {

        }
        public Student(String s1,String s2,String s3,String s4,String s5,String s6,String s7,String s8,String s9,String s10,String s11,String s12,List<Select_Course> courses)
        {
                this.sno=s1;
                this.sname=s2;
                this.sex=s3;
                this.birthday=s4;
                this.nationlity=s5;
                this.Native=s6;
                this.political=s7;
                this.district=s8;
                this.student_sourse=s9;
                this.enter_year=s10;
                this.school_year=s11;
                this.banji=s12;
                this.setCourses(courses);
        }
        @Id@NonNull
        @Setter
        private String sno;
        @NonNull private String sname;
        @NonNull private String sex;
        @NonNull private String birthday;
        @NonNull private String nationlity="汉族";
        @NonNull private String Native="东莞市";
        @NonNull private String political="共青团员";
        @NonNull private String district="松山湖校区";
        @NonNull private String student_sourse="东莞市";
        @NonNull private String enter_year;
        @NonNull private String school_year;
        @NonNull private String banji;
        @ManyToMany
        @JoinTable(name="student_course",joinColumns={@JoinColumn(name="student_id",referencedColumnName = "sno")},inverseJoinColumns = {@JoinColumn(name="course_id",referencedColumnName ="course_no" )})
        private List<Select_Course> courses;

        public void setCourses(List<Select_Course> courses) {
                this.courses = courses;
        }
}
